import { find } from "lodash";

export const getTableColumns = ({ params }) => [
	{
		title: "字典名称",
		dataIndex: "name",
		width: 140,
		ellipsis: true
	},
	{
		title: "字典类型",
		dataIndex: "code",
		width: 140,
		ellipsis: true
	},
	{
		title: "字典状态",
		dataIndex: "status",
		width: 140,
		ellipsis: true,
		render: (_: any, record: any) => {
			const result = find(COMMON_STATUS || [], (item: any) => item.value === record.status)
			return (
				<span>
					{result?.label}
				</span>
			)
		}
	},
	// {
	// 	title: "用户状态",
	// 	dataIndex: "active_current_num",
	// 	width: 100,
	// 	ellipsis: true,
	// 	render: (_: any, record: any) => {
	// 		return (
	// 			<span style={{ color: '#3976F2', cursor: 'pointer' }}>
	// 				{record.active_current_num}
	// 			</span>
	// 		)
	// 	}
	// },
	{
		title: "创建日期",
		dataIndex: "createTime",
		width: 140,
		ellipsis: true
	},
];
export const getSearchColumns = () => [
	{
		type: "input",
		placeholder: "字典名称",
		name: "name"
	},
	{
		type: "select",
		placeholder: "字典类型",
		name: "type"
	},
	{
		type: "select",
		placeholder: "字典状态",
		name: "status",
		options: COMMON_STATUS
	},
]



export const COMMON_STATUS = [
	{ label: '停用', value: 0 },
	{ label: '正常', value: 1 }
]


export const getCreateColumns = () => [
	{
		type: "input",
		placeholder: "字典名称",
		label: "字典名称",
		name: "name",
	},
	{
		type: "input",
		placeholder: "字典code",
		label: "字典code",
		name: "code",
	},
	{
		type: "radioGroup",
		placeholder: "状态",
		label: "状态",
		name: "status",
		options: COMMON_STATUS
	}
]

export const getCreateChildColumns = () => [
	{
		type: "input",
		placeholder: "标签名",
		label: "标签名",
		name: "label",
	},
	{
		type: "input",
		placeholder: "值",
		label: "值",
		name: "value",
	},
	{
		type: "input",
		placeholder: "字典code",
		label: "字典code",
		name: "code",
	},
	{
		type: "radioGroup",
		placeholder: "状态",
		label: "状态",
		name: "status",
		options: COMMON_STATUS
	}
]